<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%@ page contentType="text/html; charset=UTF-8"%>
<%@ page pageEncoding="UTF-8"%>
<%@taglib prefix="s" uri="/struts-tags"%>
<html>
	<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <script type="text/javascript">
        function on_mod_clerk(index){
          var clerks = $('#clerk_table').datagrid('getRows');
		  $('#deptno').text(clerks[index].deptno);
		  $('#deptno_val').val(clerks[index].deptno);
		  $('#workno').text(clerks[index].workno);
		  $('#workno_val').val(clerks[index].workno);
		  $('#workname').val(clerks[index].name);
		  $('#identifyno').val(clerks[index].identifyno);
		  
		  var sexs = $('#sex').combobox('getData');
		  for (i=0; i<sexs.length;i++){
		    if (sexs[i].typename==clerks[index].sexname){
		      $('#sex').combobox('setValue',clerks[index].sexid);
		      break;
		    }
		  }
		  
		  var types = $('#clerktype').combobox('getData');
		  for (i=0; i<types.length;i++){
		    if (types[i].typename==clerks[index].clerktypeName){
		      $('#clerktype').combobox('setValue',types[i].typeid);
		      break;
		    }
		  }

          $('#mod_clerk_detail_panel').window('open');
        }
        function on_mod_clerk_ui(value,row,index){
          return '<a href="#" onclick="on_mod_clerk('+index+')">修改</a>';
        }
        function nodeClicked(node){
  	      new_data_grid('#clerk_table',make_clerk_table_fields(
  	      	'修改',on_mod_clerk_ui),'getDeptClerk.action',
  	      	{deptno:node.id},16);
        }
    	$(document).ready(function(){
    		$('#depttree').tree({url:'queryDeptTree.action',onClick:nodeClicked,
    			onLoadError: function(){alert('系统错误，服务器可能已关闭！')}});
     		$('#mod_clerk_panel').panel();
     		set_query_action(null,'#clerk_table','修改',on_mod_clerk_ui,
     			'queryClerkByWorknoOrName.action',16);
    	});
    </script>
	</head>
	<body>
	<s:include value="modclerkdetail.jsp"></s:include>
    <div id="mod_clerk_panel" collapsible="false" fit="true" title="修改账户" resizable="false"
    	collapsible="false" minimizable="false" maximizable="false" closable="true" 
    	icon="icon-save" class="jquery_panel">
    	<table width="100%" height="100%">
    		<tr>
    			<td width="280px" style="vertical-align: top;white-space: nowrap">    				
    				<table>
    					<tr><td style="vertical-align:center;white-space: nowrap">
    						<s:include value="/app/query_param.jsp"/></tr>    					
    					<tr><td><ul id="depttree"></ul></td></tr>
    				</table>
    			</td>
    			<td>
    				<table id="clerk_table" title="账户基本信息表" singleSelect="true" fit="true"
						fitColumns="true" style="background-color:white;"></table>
 				</td>
    		</tr>
    	</table>
    </div>
    
    </body>
</html>